Repository navigation
fix: use Docker Compose secrets for LLM keys (#160) - #168
Conversation
|
Thanks for the PR! I'll take a proper look over the weekend, in the meanwhile could you sign your commits (https://github.com/ossf/oss-crs/blob/main/CONTRIBUTING.md#developer-certificate-of-origin-dco) and force push? We also updated main with a major internal refactor, hence the conflicts. |
fa1c941 to
4dfd9a8
Compare
|
Done mate, covered the conflicts too |
|
any updates? |
azchin
left a comment
There was a problem hiding this comment.
The main thing missing is converting LiteLLM config environment variables into secrets.
The flow is OSS-CRS picks up environment variables from the host according to litellm-config.yaml, and exposes them as env vars for the guest LiteLLM proxy Docker containers. See below for details.
| environment: | ||
| - LITELLM_MASTER_KEY={{ llm_context.litellm_master_key }} | ||
| - DATABASE_URL=postgresql://{{ postgres_user }}:{{ llm_context.postgres_password }}@{{ postgres_host }}:{{ postgres_port }}/{{ postgres_user }} | ||
| {%- for key, value in llm_context.litellm_env.items() %} |
There was a problem hiding this comment.
I think these need to be converted to secrets as well. This is where the user can provide e.g. OPENAI_API_KEY, and their LiteLLM-defined config picks it up via os.environ/OPENAI_API_KEY
What we should do here is create a wrapper script that somehow enumerates all the secret files we need (maybe convey it through a JSON or some other KVP encoding) and set the environment vars for the main LiteLLM process. Similar to how you already do export ... && exec litellm but for an arbitrary number of {environment variables : secret file}.
Unfortunately LiteLLM only supports env vars for keys in their proxy, they don't support secret files. https://docs.litellm.ai/docs/proxy/configs
The following is an example, with EXTERNAL_LITELLM_API_KEY.
|
Also since |
|
my bad for the delays reporting back in a while |
Signed-off-by: tusharshah21 <tusharkumarshah14394@gmail.com>
Signed-off-by: tusharshah21 <tusharkumarshah14394@gmail.com>
70ceb4b to
1a6bfc8
Compare
|
check now mate! |
|
Looks great! Can you resolve the CI errors? Please also apply this diff, I updated diff --git a/registry/crs-codex.yaml b/registry/crs-codex.yaml
index 7c542ea..622174b 100644
--- a/registry/crs-codex.yaml
+++ b/registry/crs-codex.yaml
@@ -3,4 +3,4 @@ type:
- bug-fixing
source:
url: https://github.com/Team-Atlanta/crs-codex.git
- ref: refactor/sidecar
+ ref: main |
Signed-off-by: tusharshah21 <tusharkumarshah14394@gmail.com>
|
Thanks for your contribution! |
fix: use Docker Compose secrets for LLM keys
Summary
Replace environment variable delivery of
LITELLM_MASTER_KEY,POSTGRES_PASSWORD, and per-CRSOSS_CRS_LLM_API_KEYwith Docker Compose file-based secrets per the Docker Compose secrets best practice(https://docs.docker.com/compose/how-tos/use-secrets/).
Previously, sensitive LLM keys were injected as plaintext environment variables into containers. They are now delivered as Docker secrets mounted at
/run/secrets/, preventing accidental exposure viadocker inspect, logs, or child process env inheritance.User Impact
CRS authors who read
OSS_CRS_LLM_API_KEYdirectly from the environmentmust update to read from the file path provided by
OSS_CRS_LLM_API_KEY_FILE:Closes #160